/**
* VUEshop
* ============================================================================
* * 版权所有 2015-2027 深圳搜豹网络科技有限公司，并保留所有权利。
* 网站地址: http://www.vueshop.com.cn
* ----------------------------------------------------------------------------
* 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
* 不允许对程序代码以任何形式任何目的的再发布。
* ============================================================================
* $Author: soubao-java 2020-07-22 $
*/<template>
	<div>
		<div id="explanation" class="explanation" style="color: rgb(85, 85, 85); background-color: rgb(243, 244, 244); width: 98%; height: 100%;">
			<div class="bckopa-tips">
				<div class="title">
					<img src="@/static/images/handd.png" alt />
					<h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
				</div>
				<ul>
					<li>微信小程序配置</li>
				</ul>
			</div>
			<span title="收起提示" id="explanationZoom" style="display: block;"></span>
		</div>
		<el-form ref="form" label-width="200px" style="margin-top:20px">
			<el-divider content-position="left">小程序配置</el-divider>
			<el-form-item label="APPID" prop="app_id">
				<el-input v-model="form.app_id" size="mini"></el-input>
				<p class="notic">小程序的APPID</p>
			</el-form-item>
			<el-form-item label="小程序secret" prop="app_secret">
				<el-input v-model="form.app_secret" size="mini"></el-input>
				<p class="notic">小程序secret</p>
			</el-form-item>
			<el-form-item>
				<el-button type="primary" @click="onSubmit()" :loading="isLoading">确认提交</el-button>
			</el-form-item>
		</el-form>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					app_id: '',
					app_secret: '',
				},
				isLoading: false
			};
		},
		created() {
			this.getMiniAppPay();
		},
		methods: {
			getMiniAppPay() {
				var that = this;
				this.request.get("/mall/mini").then(function(res) {
					if(res){
						that.form = res;
					}
				});
			},
			onSubmit() {
				var that = this;
				this.isLoading = true;
				this.request.post("/mall/mini", that.form).then(res => {
					if (res.status == 1) {
						that.$message.success("保存成功");
					} else {
						that.$message.error("保存失败,失败原因:" + res.msg);
					}
					that.isLoading = false;
				});
			}
		}
	};
</script>
<style scoped>
	>>>.el-input__inner {
		width: 300px;
	}
</style>
